/**
 * 
 */
package entitymanager;

import com.edocbase.biz.diary.entities.DiaryEntity;
import com.edocbase.biz.diary.entities.catalog.Catalog;
import com.edocbase.biz.entity.DataStoreException;
import com.edocbase.entity.EntityManager;
import com.edocbase.entity.EntityManagerFactory;
import com.edocbase.entity.StoreException;

/**
 * @author lifei114@gmail.com
 *
 */
public class EntityManagerSimple {

	static void testCatalog() throws StoreException{
		EntityManager<Catalog> catalogManager = EntityManagerFactory.getEntityManager(Catalog.class);
		Catalog catalog = new Catalog("name","action",(byte)0);
		catalogManager.save(catalog);
		Catalog c2 = catalogManager.createQuery().get(1);
		System.out.println(c2);
	}
	/**
	 * @param args
	 * @throws StoreException 
	 */
	public static void main(String[] args) throws StoreException {
		//testCatalog();
		//EntityManagerFactory.getEntityManager(MailEntity.class);
		//EntityManagerFactory.getEntityManager(WebAccount.class);
		DiaryEntity diary =new DiaryEntity();
		diary.setTitle("title");
		diary.setId(3);
		diary.setContentId("contentid");
		//EntityManagerFactory.getEntityManager(DiaryEntity.class).insert(diary);
		try {
			diary.save();
		} catch (DataStoreException e) {
			e.printStackTrace();
		}
	}

}
